package com.aplink.generic.constant.type;

public enum DirectionsStatus {
	INVALID_REQUEST(5),
	MAX_WAYPOINTS_EXCEEDED(4),
	NOT_FOUND(2),
	OK(1),
	OVER_QUERY_LIMIT(6),
	REQUEST_DENIED(7),
	UNKNOWN_ERROR(8),
	ZERO_RESULTS(3);

	public static DirectionsStatus get(int key) {
		for (DirectionsStatus directionsStatus : values()) {
			if (directionsStatus.getValue() == key) {
				return directionsStatus;
			}
		}
		return UNKNOWN_ERROR;
	}

	public static DirectionsStatus get(String name) {
		for (DirectionsStatus directionsStatus : values()) {
			if (directionsStatus.name().equalsIgnoreCase(name)) {
				return directionsStatus;
			}
		}
		return UNKNOWN_ERROR;
	}

	private int mValue;

	private DirectionsStatus(int value) {
		setValue(value);
	}

	public int getValue() {
		return mValue;
	}

	public void setValue(int value) {
		mValue = value;
	}
}
